package com.ruoyi.web.controller.cat;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.cat.domain.AdGiftClassify1;
import com.ruoyi.cat.service.IAdGiftClassify1Service;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 分类 大类Controller
 * 
 * @author ruoyi
 * @date 2025-07-05
 */
@RestController
@RequestMapping("/system/classify1")
public class AdGiftClassify1Controller extends BaseController
{
    @Autowired
    private IAdGiftClassify1Service adGiftClassify1Service;

    /**
     * 查询分类 大类列表
     */
   // @PreAuthorize("@ss.hasPermi('system:classify1:list')")
    @GetMapping("/list")
    public TableDataInfo list(AdGiftClassify1 adGiftClassify1)
    {
        startPage();
        List<AdGiftClassify1> list = adGiftClassify1Service.selectAdGiftClassify1List(adGiftClassify1);
        return getDataTable(list);
    }

    @GetMapping("/getClassifyData1")
    public AjaxResult getClassifyData1(AdGiftClassify1 adGiftClassify1)
    {
      //  startPage();
        List<AdGiftClassify1> list = adGiftClassify1Service.selectAdGiftClassify1List(null);
        return success(list);
    }

    /**
     * 导出分类 大类列表
     */
  //  @PreAuthorize("@ss.hasPermi('system:classify1:export')")
    @Log(title = "分类 大类", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AdGiftClassify1 adGiftClassify1)
    {
        List<AdGiftClassify1> list = adGiftClassify1Service.selectAdGiftClassify1List(adGiftClassify1);
        ExcelUtil<AdGiftClassify1> util = new ExcelUtil<AdGiftClassify1>(AdGiftClassify1.class);
        util.exportExcel(response, list, "分类 大类数据");
    }

    /**
     * 获取分类 大类详细信息
     */
  //  @PreAuthorize("@ss.hasPermi('system:classify1:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(adGiftClassify1Service.selectAdGiftClassify1ById(id));
    }

    /**
     * 新增分类 大类
     */
  //  @PreAuthorize("@ss.hasPermi('system:classify1:add')")
    @Log(title = "分类 大类", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AdGiftClassify1 adGiftClassify1)
    {
        return toAjax(adGiftClassify1Service.insertAdGiftClassify1(adGiftClassify1));
    }

    /**
     * 修改分类 大类
     */
   // @PreAuthorize("@ss.hasPermi('system:classify1:edit')")
    @Log(title = "分类 大类", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AdGiftClassify1 adGiftClassify1)
    {
        return toAjax(adGiftClassify1Service.updateAdGiftClassify1(adGiftClassify1));
    }

    /**
     * 删除分类 大类
     */
   // @PreAuthorize("@ss.hasPermi('system:classify1:remove')")
    @Log(title = "分类 大类", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(adGiftClassify1Service.deleteAdGiftClassify1ByIds(ids));
    }
}
